package com.jeasonzhao.report.engine;

public class ReportUserInfo
{
    private String m_strName = null;
    private String m_strId = null;
    private boolean m_isAdministrator = false;
    private java.util.Hashtable<String,Object> m_hashProperties = new java.util.Hashtable<String,Object>();
    public ReportUserInfo()
    {
        super();
    }

    public void setName(String name)
    {
        this.m_strName = name;
    }

    public void setId(String id)
    {
        this.m_strId = id;
    }

    public String getName()
    {
        return m_strName;
    }

    public String getId()
    {
        return m_strId;
    }

    public void addProperty(String strKey,Object value)
    {
        if(null == strKey || null == value || strKey.trim().length() < 1)
        {
            return;
        }
        m_hashProperties.put(strKey.trim().toLowerCase(),value);
    }

    public Object getProperty(String strKey)
    {
        if(null == strKey || strKey.trim().length() < 1)
        {
            return null;
        }
        strKey = strKey.trim().toLowerCase();
        Object ret = m_hashProperties.get(strKey);
        if(null != ret)
        {
            return ret;
        }
        if(strKey.equals("id") || strKey.equals("userid"))
        {
            return this.getId();
        }
        else if(strKey.equals("name") || strKey.equals("username"))
        {
            return this.getName();
        }
        else if(strKey.equals("isAdmin") || strKey.equals("isAdministrator"))
        {
            return Boolean.valueOf(this.isAdministrator());
        }
        else
        {
            return ret;
        }
    }

    public void setAdministrator(boolean b)
    {
        m_isAdministrator = b;
    }

    public boolean isAdministrator()
    {
        return m_isAdministrator;
    }
}
